﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn"	uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html>
  <head>
  	
  	<%@ include file="/WEB-INF/include/meta.jsp" %>
  	<%@ include file="/WEB-INF/include/css.jsp" %>
  	<link href="${ctx.resource}/css/bootstrap-switch.min.css" rel="stylesheet">
	
	<title>${startup.profile.name} - 众投湾</title>
	
	<fmt:setBundle basename="ApplicationMessage"/>
	<fmt:setLocale value="zh_CN"/>
	
  </head>

  <body>
  
	<%@ include file="/WEB-INF/include/header.jsp" %>
	
	  <div class="container">
	  
	    <div class="zz-startup-cover">
	      <a class="zz-startup-avatar-wrapper" href="${ctx}/startups/${startup.id}">
	        <img class="img-thumbnail" src="${ctx.upload}/${startup.profile.avatar}">
	      </a>
	      
	      <div class="zz-startup-cover-letter">
	        <div class="zz-startup-cover-title">${startup.profile.name}</div>
	        <span class="font-size-14 label label-success" style="font-weight: normal;">
	          <fmt:message key="${startup.profile.businessStatus.key}" /><c:if test="${not empty startup.profile.supplement}">（${startup.profile.supplement}）</c:if>
	        </span>&nbsp;
	        <span class="font-size-14 label label-success" style="font-weight: normal;">
	          <fmt:message key="${startup.fundStatus.key}" />
	        </span>
	        <p class="line-ellipsis font-size-16 bottom-margin-15">${startup.profile.alias}</p>
	        <p class="line-ellipsis text-muted font-size-14 bottom-margin-15">
	          <i class="glyphicon glyphicon-map-marker"></i>&nbsp;${startup.profile.region}&nbsp;&nbsp;&nbsp;&nbsp;
	          <i class="glyphicon glyphicon-tags"></i>
	          <c:forEach var="tag" items="${fn:split(startup.tags, ',')}" varStatus="count">
	          	<c:choose>
	          	  <c:when test="${count.index == 0}">
	          	    &nbsp;${tag}
	          	  </c:when>
	          	  <c:otherwise>
	          	    &nbsp;<strong>·</strong>&nbsp;${tag}
	          	  </c:otherwise>
	          	</c:choose>
	          </c:forEach>
	        </p>
	        
	        <c:if test="${isLoginUser}">
	        <div class="operation-button-groups">
	          <c:choose>
			  <c:when test="${isSubscribed}">
	          	<a href="javascript:unsubscribe(${startup.id});" id="subscribe-btn" class="btn btn-success demo2do-input-small-width">取消关注</a>
			  </c:when>
			  <c:otherwise>
	          	<a href="javascript:subscribe(${startup.id});" id="subscribe-btn" class="btn btn-success demo2do-input-small-width">关注</a>
			  </c:otherwise>
			  </c:choose>

	          <a href="#" class="btn btn-primary demo2do-input-small-width">分享</a>
	        </div>
			</c:if>
	      </div><!-- zz-startup-cover-letter -->
	      
	      <ul class="nav nav-tabs zz-startup-tabs">
	        <li><a href="${ctx}/startups/${startup.id}/detail">项目概况</a></li>
	        <li><a href="${ctx}/startups/${startup.id}/finance">投资逻辑</a></li>
	        <li><a href="${ctx}/startups/${startup.id}/team">团队简介</a></li>
	        <li class="active"><a href="javascript: void(0)">项目动态</a></li>
	      </ul>
	    </div><!-- zz-startup-cover -->
	    
	    <div class="zz-startup-content">
	      
	      <div class="col-lg-8 col-md-8 zz-startup-left-layout">
	        
	        <div class="panel panel-default zz-startup-panel">
	          <div class="panel-body">
	          
	            <ul class="nav nav-pills zz-breadcrumb-nav">
	              <li><a class="font-size-16" href="${ctx}/startups/${startup.id}/events"><i class="glyphicon glyphicon-fire" title="大事记"></i>&nbsp;大事记</a></li>
	              <li><a class="font-size-16" href="${ctx}/startups/${startup.id}/ratings"><i class="glyphicon glyphicon-stats" title="评分"></i>&nbsp;评分</a></li>
	              <li><a class="font-size-16" href="${ctx}/startups/${startup.id}/discussions"><i class="glyphicon glyphicon-edit" title="讨论"></i>&nbsp;讨论</a></li>	              
	              <li class="active"><a class="font-size-16" href="javascript: void(0)"><i class="glyphicon glyphicon-plane" title="约谈"></i>&nbsp;约谈</a></li>
	              <li><a class="font-size-16" href="${ctx}/startups/${startup.id}/fans"><i class="glyphicon glyphicon-heart-empty" title="粉丝"></i>&nbsp;关注</a></li>
	            </ul>
	            
	            <c:choose>
	              <c:when test="${empty meets}">
	                <p style="padding: 5px 10px; line-height: 20px;">暂无约谈记录</p>
	              </c:when>
	              <c:otherwise>
	                
	                <ul class="media-list" style="padding: 0px 10px;">
	                  <c:forEach var="meet" items="${meets}">
	                    <li class="media">
	                      <a class="pull-left" href="#"><img class="media-object" src="${ctx.upload}/${meet.profile.avatar}" width="80px" height="80px"></a>
	                      <div class="media-body meet-body">
	                        <p>
	                          <a class="no-text-decoration" href="#"><b>${meet.profile.name}</b></a>&nbsp;约谈了<b>${startup.profile.name}</b>
	                          <small class="pull-right"><span class="font-size-12"><fmt:formatDate value="${meet.createTime}" pattern="MM月dd日 HH:mm"/></span></small>
	                        </p>
	                      </div>
	                    </li>
	                  </c:forEach>
	                </ul>
	                
	                <jsp:include page="/WEB-INF/include/page.jsp">
	                  <jsp:param name="url" value="/startups/${startup.id}/meets"/>
		            </jsp:include>
	                
	              </c:otherwise>
	            </c:choose>
	            
	          </div>
	        </div>
	        
	      </div><!-- zz-startup-left-layout -->
	      
		  <%@ include file="/WEB-INF/jsps/startup/include/right-layout.jsp" %>
	      
	    </div><!-- zz-startup-content -->
	    
	  </div>
	
	<%@ include file="/WEB-INF/include/footer.jsp" %>
	<%@ include file="/WEB-INF/include/script.jsp" %>
	<script src="${ctx.resource}/js/jquery.raty.min.js"></script>
	<script src="${ctx.resource}/js/bootstrap-modal-trigger.js"></script>
	<script src="${ctx.resource}/js/bootstrap.validate.js"></script>
    <script src="${ctx.resource}/js/bootstrap.validate.en.js"></script>
    <script src="${ctx.resource}/js/bootstrap-switch.min.js"></script>
	
	<script>
	
	  function subscribe(id) {
	    $.get("${ctx}/startups/"+id+"/subscribe",function(data,status){
		  if(data) {
		    $('#subscribe-btn').text('取消关注');
		    $('#subscribe-btn').attr('href', 'javascript:unsubscribe('+id+');');
		  }
	    });
	  }

	  function unsubscribe(id) {
	    $.get("${ctx}/startups/"+id+"/unsubscribe",function(data,status){
	      if(data) {
		    $('#subscribe-btn').text('关注');
		    $('#subscribe-btn').attr('href', 'javascript:subscribe('+id+');');
		  }
	    });
	  }

	  $(function() {
		$(".show-rating").raty({
		  path      : "${ctx.resource}/img",
		  half      : true,
		  target    : ".show-rating-hint",
		  readOnly  : true,
		  score     : function() {
		    return $(this).data("score");
		  }
		});
		
		$(".show-rating").each(function() {
		  $(this).next().text($(this).data("score"));
		});
	  });
	  
	</script>
    
  </body>
  
</html>
